잠시만 기다려 주세요

     '시장이나 돌면서 가짜 민생 외치는 이재명을 규탄한다. 싸우지 않을 거면 내려와라... 야당대표는 당신의 방탄이나 하는 자리가 아니다.'
전체검색 :  
이번주 로또 및 연금번호 발생!!   |  HOME   |  여기는?   |  바다물때표   |  알림 (16)  |  여러가지 팁 (1054)  |  추천 및 재미 (150)  |  자료실 (22)  |  
시사, 이슈, 칼럼, 평론, 비평 (582)  |  끄적거림 (127)  |  문예 창작 (702)  |  바람 따라 (69)  |  시나리오 (760)  |  드라마 대본 (248)  |  
살인!


    postgresql

postgresql - postgresql 튜플 tuple 상태보기. 최적화 베큠 vacuumdb 실행하기.. 테이블 용량 최적화, 줄이기.
이 름 : 바다아이   |   조회수 : 9030         짧은 주소 : https://www.bada-ie.com/su/?601591783482
SELECT c.relname, pg_stat_get_live_tuples(c.oid) + pg_stat_get_dead_tuples(c.oid) as t_tup,
pg_stat_get_live_tuples(c.oid) AS n_live_tup,
pg_stat_get_dead_tuples(c.oid) AS n_dead_tup,
round(100*pg_stat_get_live_tuples(c.oid) / (pg_stat_get_live_tuples(c.oid) + pg_stat_get_dead_tuples(c.oid)),2) as live_tuple_rate,
round(100*pg_stat_get_dead_tuples(c.oid) / (pg_stat_get_live_tuples(c.oid) + pg_stat_get_dead_tuples(c.oid)),2) as dead_tuple_rate,
pg_size_pretty(pg_total_relation_size(c.oid)) as total_rel_size,
pg_size_pretty(pg_relation_size(c.oid)) as rel_size
FROM pg_class as c
WHERE pg_stat_get_live_tuples(c.oid) > 0
AND c.relname NOT LIKE 'pg_%' ORDER BY n_live_tup DESC;


봐서 vacuumdb 돌려야 겠다 싶으면 바로 돌리세요.... 그래야 찌꺼기 날리죠....
postgresql 이 이게 좀 귀찮은 일인데... 아무튼... 그래도 정기적인 vacuumdb 는 해 주어야 합니다.
안 그러면 무한대로 테이블이 커져요....
delete 나 update 했다고 실제 데이터가 삭제되는 게 아닙니다. 반드시 vacuumdb 실행 할 것....
용량이 크거나 사용자 접속이 많은 곳은 새벽에 돌리세요..... 시간 오래 걸립니다.

vacuumdb -U 사용자 -d 디비명 -f

아니면 터미널에서 해당 디비로 접속, 가급적 유저는 postgres 로 접속하세요. 명령어는 아래와 같습니다.....
유저를 postgresql 로 접속 안 하시면 vacuum 시 통계 및 기타 테이블들 권한 없다고 나옵니다.

psql -U postgres -d 디비명

아래 참고 하시고 맞는 거 하세요...
그냥 vacuum 치면 해당 디비 테이블 전부다 합니다.


    Plain VACUUM: Frees up space for re-use

    VACUUM [tablename]

    Full VACUUM: Locks the database table, and reclaims more space than a plain VACUUM

    /* Before Postgres 9.0: */
    VACUUM FULL
    /* Postgres 9.0+: */
    VACUUM(FULL) [tablename]

    Full VACUUM and ANALYZE: Performs a Full VACUUM and gathers new statistics on query executions paths using ANALYZE

    /* Before Postgres 9.0: */
    VACUUM FULL ANALYZE [tablename]
    /* Postgres 9.0+: */
    VACUUM(FULL, ANALYZE) [tablename]

    Verbose Full VACUUM and ANALYZE: Same as #3, but with verbose progress output

    /* Before Postgres 9.0: */
    VACUUM FULL VERBOSE ANALYZE [tablename]
    /* Postgres 9.0+: */
    VACUUM(FULL, ANALYZE, VERBOSE) [tablename]

 
| |





      1 page / 2 page
번 호 카테고리 제 목 이름 조회수
45 postgresql postgresql ... postgresql 14 .. postgresql.conf port 5432 .. 바다아이 676
44 postgresql , count(*) .... 바다아이 6854
43 postgresql How to do an update + join in PostgreSQL?, 바다아이 6086
42 postgresql sequence(퀀) 바다아이 7718
41 postgresql , , , index create, , 바다아이 8100
40 postgresql postgresql log_timezone .... 바다아이 6504
39 postgresql postgresql SEQUENCE reset .... 바다아이 8340
38 postgresql [PostgreSql] WITH , , Operator 바다아이 7730
37 postgresql postgresql for, foreach , 바다아이 9284
36 postgresql postgresql , , into ... 바다아이 9282
35 postgresql postgresql PL/pgSQL - SQL Procedural Language, , 바다아이 10697
34 postgresql postgresql ... .. , , 바다아이 11711
33 postgresql postgresql CSV export/import 바다아이 8516
32 postgresql postgresql tablespace , .... 바다아이 12838
31 postgresql postgresql 10 partitioning, ... , ... 바다아이 9254
30 postgresql Using PostgreSQL Arrays, ... ... 바다아이 9222
29 postgresql PostgreSQL (TRIGGER) (function) 바다아이 8984
28 postgresql Optimize and Improve PostgreSQL Performance with VACUUM, ANALYZE, and REINDEX 바다아이 9633
현재글 postgresql postgresql tuple . vacuumdb .. , . 바다아이 9031
26 postgresql postgresql , .. 바다아이 9225
25 postgresql postgresql , size, 바다아이 11223
24 postgresql postgresql , , .... 바다아이 8271
23 postgresql PostgreSQL Replication, , , master, slave 바다아이 10771
22 postgresql postgresql case 바다아이 8138
21 postgresql postgresql with 바다아이 8575
20 postgresql postgresql , , string 바다아이 11482
19 postgresql Postgresql partitioning table , , , 바다아이 9074
18 postgresql PostgreSQL 바다아이 10563
17 postgresql postgresql vacuumdb, psql, pg_dump password crontab , pgpass 바다아이 10248
16 postgresql postgresql sequence 퀀 auto_increment . 바다아이 9666
| |









Copyright ⓒ 2001.12. bada-ie.com. All rights reserved.
이 사이트는 리눅스에서 firefox 기준으로 작성되었습니다. 기타 브라우저에서는 다르게 보일 수 있습니다.
[ Ubuntu + GoLang + PostgreSQL + Mariadb ]
서버위치 : 오라클 클라우드 춘천  실행시간 : 0.05522
to webmaster... gogo sea. gogo sea.